package org.kernely.stream.administration;

import org.kernely.ui.mvp.IKernelyView;

import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout;

/**
 * The presenter of the management of the window, containing save and cancel buttons.
 */
@SuppressWarnings("serial")
public class StreamManagementWindowView extends VerticalLayout implements IKernelyView{
	
	/**
	 * TabPanel which will contains Informations/Roles
	 */
	private TabSheet tabsheet;

	private HorizontalLayout hlayout;
	private Button saveButton;
	private Button cancelButton;
	
	/**
	 * Default constructor of StreamManagementWindowView
	 */
	public StreamManagementWindowView(){
		tabsheet = new TabSheet();
		tabsheet.setSizeFull();
		this.tabsheet.setHeight(320, Sizeable.UNITS_PIXELS);
		this.hlayout = new HorizontalLayout();
		this.saveButton = new Button("Save");
		this.cancelButton = new Button("Cancel");
		
		this.addComponent(tabsheet);
		
		this.addComponent(this.hlayout);
		this.hlayout.addComponent(this.saveButton);
		this.hlayout.addComponent(this.cancelButton);
		this.hlayout.setMargin(true, false, true, false);
		this.hlayout.setWidth(450, Sizeable.UNITS_PIXELS);
		// Alignment of the buttons
		this.hlayout.setComponentAlignment(this.saveButton, Alignment.MIDDLE_CENTER);
		this.hlayout.setComponentAlignment(this.cancelButton, Alignment.MIDDLE_CENTER);
		
		this.setSizeUndefined();
	}

	/**
	 * @return the tabsheet
	 */
	public final TabSheet getTabsheet() {
		return tabsheet;
	}

	/**
	 * @return the saveButton
	 */
	public final Button getSaveButton() {
		return saveButton;
	}

	/**
	 * @return the cancelButton
	 */
	public final Button getCancelButton() {
		return cancelButton;
	}

	/**
	 * Useless method.
	 */
	public final Component getComponent() {
		return this;
	}

}
